home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 July / macformat-026.iso / mac / Shareware City / Science / µSim 1.0 folder / source / Globals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-07  |  7.9 KB  |  451 lines  |  [TEXT/MMCC]

  1. #if GENERATINGCFM
  2.  
  3.    enum {
  4.       myUppListClickLoopProcInfo = kRegisterBased
  5.       | RESULT_SIZE(kNoByteCode)
  6.       | REGISTER_RESULT_LOCATION(kCCRegisterZBit)
  7.    };
  8.    
  9.    #define MyNewListClickLoopProc(userRoutine)  \
  10.       (ListClickLoopUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), \
  11.       myUppListClickLoopProcInfo, GetCurrentISA())
  12.          
  13.    #define kListClickLoopTrue false
  14.    #define kListClickLoopFalse true
  15.       
  16. #else
  17.  
  18.    #define MyNewListClickLoopProc(userRoutine)  \
  19.       (ListClickLoopUPP)(userRoutine)
  20.          
  21.    #define kListClickLoopTrue true
  22.    #define kListClickLoopFalse false
  23.  
  24. #endif
  25.  
  26. /* balloon help */
  27. enum balllll {
  28. kBalloons_Anim = 1010,
  29. kBalloons_Regs,
  30. kBalloons_MPrg,
  31. kBalloons_Dump,
  32. kBAnim_ALatch = 1,
  33. kBAnim_BLatch,
  34. kBAnim_MAR,
  35. kBAnim_MBR,
  36. kBAnim_AMUX,
  37. kBAnim_Shifter,
  38. kBAnim_Inc,
  39. kBAnim_MMUX,
  40. kBAnim_MPC,
  41. kBAnim_ALU,
  42. kBAnim_MSL,
  43. kBAnim_MIR,
  44. kBAnim_Regs,
  45. kBAnim_CStore,
  46. kBAnim_MAP,
  47. kBRegs_Base = 1,
  48. kBRegs_PC,
  49. kBRegs_AC,
  50. kBRegs_SP,
  51. kBRegs_BP,
  52. kBRegs_IR,
  53. kBRegs_A,
  54. kBRegs_B,
  55. kBRegs_C,
  56. kBRegs_D,
  57. kBRegs_E,
  58. kBRegs_X12,
  59. kBRegs_X11,
  60. kBRegs_Lo8,
  61. kBMPr_ABus = 1,
  62. kBMPr_BBus,
  63. kBMPr_CBus,
  64. kBMPr_MAR,
  65. kBMPr_MBR,
  66. kBMPr_BusReq,
  67. kBMPr_Shifter,
  68. kBMPr_Branch,
  69. kBMPr_ALU,
  70. kBMPr_ABusRadio,
  71. kBMPr_MBRRadio,
  72. kBMPr_MAP,
  73. kBMPr_BranchTo,
  74. kBMPr_Comment,
  75. kBMPr_CommentsList,
  76. kBMPr_ConvInstrList,
  77. kBDump_Contents = 1,
  78. kBDisasm_Contents,
  79. kBIO_Contents
  80. };
  81.  
  82. /*    kScrollbarAdjust and kScrollbarWidth are used in calculating
  83.     values for control positioning and sizing. */
  84. enum {
  85. kScrollbarAdjust = 15,
  86. kScrollbarWidth
  87. };
  88.  
  89. enum {
  90. khiliteGhost = 50    /* defined in Inside Mac V, but NOT in QuickDraw.h: why??? */
  91. };
  92.  
  93. enum suoni {
  94. kSndPinzatrice = 256
  95. };
  96.  
  97. /* Menu list resource IDs */
  98. enum {
  99. kRes_Menu_HMemory = 1,
  100. kRes_Menu_HRegs,
  101. kRes_Menu_HDisasm,
  102. kRes_Menu_HDump,
  103. kRes_Menu_PopDump = 264,
  104.  
  105. kRes_Menu_Windows = 131,
  106. kRes_Menu_Control,
  107. kRes_Menu_Assembler
  108. };
  109.  
  110. enum {
  111. kD_Edit = 1,
  112. kD_Disasm = 3,
  113. kD_DisasmFrom,
  114. kD_DumpFrom
  115. };
  116.  
  117. enum {
  118. kMItem_About__Simulato = 1
  119. };
  120.  
  121. enum fileitems {
  122. kMItem_New = 1,
  123. kMItem_Open_Control_St,
  124. kMItem_Close = 4,
  125. kMItem_Save_Control_St,
  126. kMItem_Save_Control_St2,
  127. kMItem_Save_CS_Stationery,
  128. kMItem_Revert_to_Saved,
  129. kMItem_HMem = 10,
  130. kMItem_HRegs,
  131. kMItem_Page_Setup = 13,
  132. kMItem_Print,
  133. kMItem_Prefs = 16,
  134. kMItem_Quit = 18
  135. };
  136.  
  137. enum {
  138. kMItem_Select_All = 7,
  139. kMItem_Insert = 9,
  140. kMItem_Delete,
  141. kMItem_CopyEmailAddr = 12,
  142. kMItem_CopyWWWURL
  143. };
  144.  
  145. enum windowsitems {
  146. kMItem_Animation = 1,
  147. kMItem_Registers,
  148. kMItem_IO,
  149. kMItem_Microprogram,
  150. kMItem_Disasm,
  151. kMItem_Dump
  152. };
  153.  
  154. enum hieritems {
  155. kMItem_Open = 1,
  156. kMItem_Save_As
  157. };
  158.  
  159. enum controlitems {
  160. kMItem_Go = 1,
  161. kMItem_Stop,
  162. kMItem_StepSub = 4,
  163. kMItem_StepMicro,
  164. kMItem_StepInstr,
  165. kMItem_ResetMem = 8,
  166. kMItem_ResetRegs,
  167. kMItem_Disasmfrom = 11,
  168. kMItem_Dumpfrom,
  169. kMItem_SelectCurMPC
  170. };
  171.  
  172. enum asmitems {
  173. kMItem_Assemble_file = 1,
  174. kMItem_AsmPrefs = 3
  175. };
  176.  
  177. /* sizes */
  178. enum sizes {
  179. kNUMOFPARTS = 10,
  180. kNUMOFSTATEPARTS = 23,
  181. kSIZE_RAM = 128*1024L,
  182. kSIZE_ASSMEM = 256,
  183. kSIZE_CSMEM = 512
  184. };
  185.  
  186. /* registers */
  187. enum registers {
  188. kREG_PC = 0,
  189. kREG_AC,
  190. kREG_SP,
  191. kREG_BP,
  192. kREG_IR,
  193. kREG_A,
  194. kREG_B,
  195. kREG_C,
  196. kREG_D,
  197. kREG_E,
  198. kREG_EXT12,
  199. kREG_EXT11,
  200. kREG_LOW8,
  201. kREG_ZERO,
  202. kREG_ONE,
  203. kREG_MINUS1,
  204. kNUMOFREGS
  205. };
  206.  
  207. enum micstatus {
  208. kST_STOPPED = 0,
  209. kST_GOING,
  210. kST_STEPASM,
  211. kST_STEPMPROG,
  212. kST_STEPSUBCYC
  213. };
  214.  
  215. /* resources types, file types, creator */
  216. enum filetypes {
  217. krInstructions = 'OPCO',
  218. krHandlers = 'HAND',
  219. kFTY_CSTORE = 'µPRG',
  220. kFTY_RAM = 'µRAM',
  221. kFCR_MINE = 'µSIM',
  222. kFTY_CSTOREPAD = 'sPRG',
  223. kFTY_REG = 'µREG'
  224. };
  225.  
  226. /* alerts */
  227.  
  228. enum somealerts {
  229. kALRT_RESETMEM = 128,
  230. kALRT_NOSAFESAVE = 129,
  231. kALRT_NOSAVE = 132,
  232. kALRT_RESETREGS = 139,
  233. kALRT_STKOVERFLOW = 140,
  234. kALRT_MEMTOOFULL = 141,
  235. kALRT_REVERT,
  236. kALRT_CPURUNNING = 143,
  237. kALRT_STKUNDERFLOW = 144,
  238. kALRT_INFLOOP,
  239. kALRT_TOSHELL,
  240. kALRT_WRONGEXISTINGDOC,
  241. kALRT_SAVE = 200
  242. };
  243.  
  244. /* strings */
  245. enum {
  246. kSTR_PREFSFILENAME = 138
  247. };
  248.  
  249. enum {
  250. kSTR_RAMPROMPT = 133,
  251. kSTR_RAMDEFNAME,
  252. kSTR_REGSPROMPT = 139,
  253. kSTR_REGSDEFNAME
  254. };
  255.  
  256. /* save selectors */
  257. enum savesel {
  258. kGOT_SAVE = 0,
  259. kGOT_SAVEAS,
  260. kGOT_SAVESTATIONERY
  261. };
  262.  
  263. enum defaultregs {
  264. kPCStart = 8192,
  265. kStackBase = 65536-4098,
  266. kStackSize = 1024,
  267. kPCExitToShell = 4096,
  268. kIllegalVector = 3,
  269. kIllegalHandler = 0x300,
  270. kIllegalHandlerCode = 128
  271. };
  272.  
  273. enum myAEIDs {
  274. kAEmySignalIO = 'I/O '
  275. };
  276.  
  277. enum editdialogstrs {
  278. kInThe = 0,
  279. kAtMem,
  280. kValueFollow = 130
  281. };
  282.  
  283. enum {
  284. kCurPrefsVersion = 4
  285. };
  286.  
  287. enum {
  288. kfIsStationery = (1 << 11)
  289. //fNameLocked = (1 << 12)
  290. };
  291.  
  292.  
  293. #define PTR2MEMWORD(address)    ((unsigned long)((Ptr)(address) - gMMemory) >> 1)
  294.  
  295. #define PRCT_T(f)    (f->portRect.top)
  296. #define PRCT_L(f)    (f->portRect.left)
  297. #define PRCT_B(f)    (f->portRect.bottom)
  298. #define PRCT_R(f)    (f->portRect.right)
  299.  
  300. /* Define HiWrd and LoWrd macros for efficiency. */
  301. #define HiWrd(aLong)    (short)(((unsigned long)aLong) >> 16)
  302. #define LoWrd(aLong)    (short)((aLong) & 0xFFFF)
  303.  
  304. /* ======================================================= */
  305.  
  306. union u_mir {
  307.     struct {
  308.         unsigned    amux    : 1;
  309.         unsigned    cond    : 2;
  310.         unsigned    alu        : 2;
  311.         unsigned    shift    : 2;
  312.         unsigned    mbr        : 1;
  313.         unsigned    rd        : 1;
  314.         unsigned    wr        : 1;
  315.         unsigned    mar        : 1;
  316.         unsigned    dsc        : 1;
  317.         unsigned    a        : 4;
  318.         unsigned    b        : 4;
  319.         unsigned    c        : 4;
  320.         unsigned    map        : 1;
  321.         unsigned    addr    : 7;
  322.         } bits;
  323.     unsigned long cstore;
  324.     };
  325.  
  326. typedef union u_mir un_mir;
  327.  
  328.  
  329. #if defined(powerc) || defined (__powerc)
  330. #pragma options align=mac68k
  331. #endif
  332. struct ROpcode {
  333.     OSType    instr;
  334.     Byte    length;
  335.     Byte    class;
  336.     Byte    offsetHB;
  337.     Byte    offsetLB;
  338.     Byte    lastHB;
  339.     Byte    lastLB;
  340.     };
  341. #if defined(powerc) || defined(__powerc)
  342. #pragma options align=reset
  343. #endif
  344.  
  345. typedef struct ROpcode ROpcode;
  346. typedef ROpcode *ROpcodePtr;
  347. typedef ROpcodePtr *ROpcodeHandle;
  348.  
  349. #if defined(powerc) || defined (__powerc)
  350. #pragma options align=mac68k
  351. #endif
  352. struct ROpcodeDisasm {
  353.     OSType    instr;
  354.     Byte    length;
  355.     Byte    class;
  356.     short    first;
  357.     short    last;
  358.     };
  359. #if defined(powerc) || defined(__powerc)
  360. #pragma options align=reset
  361. #endif
  362.  
  363. typedef struct ROpcodeDisasm ROpcDisasm;
  364. typedef ROpcDisasm *ROpcDisasmPtr;
  365. typedef ROpcDisasmPtr *ROpcDisasmHandle;
  366.  
  367. #if defined(powerc) || defined (__powerc)
  368. #pragma options align=mac68k
  369. #endif
  370. struct myprefs {
  371.     short    prefsVersion;
  372.     short    RegsBase;
  373.     Rect    IOUserState;
  374.     Point    AnimTopLeft;
  375.     Point    RegsTopLeft;
  376.     Point    MProgTopLeft;
  377.     Point    DumpTopLeft;
  378.     Point    DisasmTopLeft;
  379.     Point    generalPrefsTL;
  380.     Point    asmPrefsTL;
  381.     Point    editValueTL;
  382.     Point    aboutTL;
  383.     Point    creditsTL;
  384.     unsigned short    DefPCValue;
  385.     unsigned short    DefSPValue;
  386.     short    DefStkSize;
  387.     short    DumpHeight;
  388.     short    DumpScrollVal;
  389.     short    DisasmHeight;
  390.     short    DisasmScrollVal;
  391.     Boolean AnimVisible;
  392.     Boolean    RegsVisible;
  393.     Boolean    IOVisible;
  394.     Boolean    DumpVisible;
  395.     Boolean    DisasmVisible;
  396.     Boolean infLoopsDetect;
  397.     Boolean    remembWind;
  398.     Boolean    NeXTScroll;
  399.     };
  400. #if defined(powerc) || defined(__powerc)
  401. #pragma options align=reset
  402. #endif
  403.  
  404. /************************************************************/
  405. extern EventRecord    gMyEvent;
  406. extern GrowZoneUPP        gMyGrowZoneUPP;
  407. extern ListClickLoopUPP    gInstrClikLoopUPP;
  408. extern ListClickLoopUPP    gCommentClikLoopUPP;
  409. extern ListClickLoopUPP    gSwitchCursClikLoopUPP;
  410. extern TEHandle    gTheInput;
  411. extern unsigned long    gSleep;
  412. extern CursHandle    gWatchHandle, gIBeamHandle, gPlusHandle;
  413. extern short    gRstatus, gZoomFactor;
  414. extern short    gSubclk;
  415. extern Boolean    gDoneFlag;
  416. extern Boolean  gInTheForeground;
  417. extern Boolean    gHasColorQD, gPwrManagerIsPresent;
  418. extern Boolean gDragManagerActive;
  419.  
  420. extern struct myprefs gPrefs;
  421.  
  422. extern short    gRegs[kNUMOFREGS];
  423. extern short    gParts[kNUMOFPARTS];
  424. extern Ptr    gMMemory;
  425. extern Ptr    gAssMemory;
  426. extern union u_mir *gCsMemory;
  427. extern unsigned short    gILCBase;
  428.  
  429. extern MenuHandle    gMenu_Apple;
  430. extern MenuHandle    gMenu_File;
  431. extern MenuHandle    gMenu_Edit;
  432. extern MenuHandle    gMenu_Windows;
  433. extern MenuHandle    gMenu_Control;
  434. extern MenuHandle    gMenu_Assembler;
  435. extern MenuHandle    gMenu_Memory;
  436. extern MenuHandle    gMenu_Registers;
  437. extern MenuHandle    gMenu_DisasmF;
  438. extern MenuHandle    gMenu_DumpF;
  439. extern MenuHandle    gPopMenu;
  440.  
  441.  
  442. extern WindowPtr    gWPtr_Animation;
  443. extern WindowPtr    gWPtr_Dump;
  444. extern WindowPtr    gWPtr_Microprogram_Ed;
  445. extern WindowPtr    gWPtr_Registers;
  446. extern WindowPtr    gWPtr_Disasm;
  447. extern WindowPtr    gWPtr_IO;
  448.  
  449. //pascal Boolean HVInRect(short h, short v, const Rect *r) = 0xA8AD;
  450.  
  451.